﻿Imports DTO
Imports System.Data.Linq

Public Class TheLoaiDao

    Public Shared Function LayBang() As Table(Of TheLoai)
        Dim db As New ThuVienDataContext()
        Return db.TheLoais
    End Function

    Public Shared Function LayDanhSach() As IEnumerable(Of TheLoai)
        Dim lst As IEnumerable(Of TheLoai)
        Dim db As New ThuVienDataContext()
        lst = From tl In db.TheLoais Select tl
        Return lst
    End Function

    Public Shared Function LayLoai(ByVal m As Integer) As TheLoai
        Dim tl As TheLoai
        Dim db As New ThuVienDataContext()
        tl = (From l In db.TheLoais Where l.MTL = m Select l).Single
        Return tl
    End Function
End Class
